home *** CD-ROM | disk | FTP | other *** search
-
- tBU v1.1 - Batch Utility - Planet Terus
-
- [ Lines beginning with (*) are those added by a fan of
- the program who thought the docs needed a bit of improvement ]
-
- Usage: tbu <option symbol arg1 arg2 ...> <option ... >
-
- Sets the DOS environment symbol based on the option chosen. tBU will
- process multiple sets of option-symbol-arg sets from left to right.
-
- (*) The program's author has used the word "symbol" to mean what most
- (*) people call a "variable" - as in: "environment symbol" means
- (*) "environment variable."
-
- Symbols may be used in batch commands as %SYMBOL% (symbol must appear
- in all capital letters). The symbol set by tBU CAN be empty. To check
- for an empty symbol use something like:
- IF (%SYMBOL%) == () echo It's empty
- IF not (%SYMBOL%) == () echo It's not empty
-
- ERRORLEVEL is returned as 255 if error occured. The option character
- may be either a dash (-) or a slash (/).
-
- (*) I have not found that the environment variables need to be
- (*) typed in all caps. Not with DOS 3.1, anyway.
-
- (*) I have found that the program will fail consistently if you type
- (*) the command-line switches, such as "-f" or whatever, in CAPS.
- (*) Maybe that won't happen to everyone, but I must always type them
- (*) in lower case to get them to work!
-
- Options:
- -f Parse filename & extension. <sym> <filespec>
- Sets symbol to the filename portion of arg1. Any dot name/
- extension separator is not changed.
- ERRORLEVEL: Length of resulting string.
- Example: tbu -f file c:\tbu.exe sets file to tbu.exe
- tbu -f file c:\data. sets file to data.
- tbu -f file c:\data sets file to data
-
- -x Parse file extension only. <sym> <filespec>
- Sets symbol to the extension portion of arg1. The dot name/
- extension separator is always removed.
- ERRORLEVEL: Length of resulting string.
- Example: tbu -e ext c:\cmd\tbu.exe sets ext to exe
-
- (*) The "." from the file name is NOT preserved in an environment
- (*) variable created with the "-x" switch.
-
- -n Parse name only. <sym> <filespec>
- Sets symbol to the name portion of arg1. The dot name/
- extension separator is always removed.
- ERRORLEVEL: Length of resulting string.
- Example: tbu -n name c:\tbu.exe sets name to tbu
-
- (*) The "." from the file name is NOT preserved in an environment
- (*) variable created with the "-n" switch.
-
- (*) Here is an instance in which you can stack commands on one
- (*) line. Let's say your %1 parameter for a batch file is a file
- (*) name, complete with extension. You could get the primary name
- (*) and the extension into two different variables in two different
- (*) passes, like this:
- (*) tbu -n name %1
- (*) tbu -x ext %1
-
- (*) But why not do it in one pass? Like this:
- (*) tbu -n name %1 -x ext %1
- (*) Works fine.
-
- -l Parse disk drive letter only. <sym> <filespec>
- Sets symbol to the drive letter portion of arg1. The colon
- drive/name separator is always removed.
- ERRORLEVEL: Length of resulting string.
- Example: tbu -d drive c:\tbu.exe sets drive to c
-
- -c Input character from keyboard. <sym> [prompt] [valid] [secs]
- Sets symbol to the upper case value of the character entered.
- Optional prompt (may be ""). Optional valid characters, are
- not case sensitive. Optional seconds for timed input. Accepts
- printable keys only.
- ERRORLEVEL: ASCII code of character entered, 0 = timeout.
- Example: tbu -c ans "Ok (Y/N)?" sets ans to any & prompts.
- Example: tbu -c ans "" yn sets ans to Y or N.
- Example: tbu -c ans "" "" 20 sets ans to any & times 20 secs.
-
- (*) It appears as if it's possible to use a \ character to delimit
- (*) quote marks if you want them to be part of the prompt line. That
- (*) is, if you wanted your prompt line to read:
- (*) What's your "handle" today?
- (*) *with* the quotes, you should make the instruction look something like:
- (*) tbu -c ans "What's your \"handle\" today? "
-
- (*) If you use the -c operator and you have not specified a particular
- (*) string to be used for the response, and if you hit ENTER, it looks
- (*) as if a single space is entered into the variable you specify
- (*) in the command. In other words, it creates the variable and puts a
- (*) space - or maybe a NUL character, I dunno - into the variable.
-
- (*) Note: if you use a time-delay and the program times out, you
- (*) get a moderately loud, shrill beep out of it. Just be warned,
- (*) it's not especially restful.
-
- -s Input string from keyboard. <sym> [prompt] [max length]
- Sets symbol to the string entered. Optional prompt (may
- be ""). Optional max input length (128 chars default).
- ERRORLEVEL: Length of string entered.
- Example: tbu -s user "Your name: " sets user to string.
-
- (*) In other words, the program sends the prompt:
- (*) Your name:
- (*) to the screen. Type something and hit ENTER. Then
- (*) an environment variable "USER" is written, containing
- (*) whatever you typed in response.
-
- (*) In this case if you press ENTER in response to the prompt,
- (*) the program does NOT create a variable having the specified name.
-
- (*) When using either the -s or -c options, you can include ANSI.SYS
- (*) cursor positioning commands in the prompt text. Using <esc> to mean
- (*) the <esc> character (alt 27), here's an example:
-
- (*) tbu -s ans "<esc>[2J<esc>[14;8HThis is the prompt text: "
-
- (*) Result: clears the screen and places the prompt line beginning
- (*) at row 14, column 8. ANSI.SYS text attribute commands can also
- (*) be placed into the prompt line this way.
-
- (*) The "max length" function mentioned in the docs above does not
- (*) appear to work at all.
-
- (*) Other undocumented features: if you use the -s switch and
- (*) create a prompt line, while entering text on the prompt line
- (*) you can use CTRL W to delete a word to the left of the cursor.
- (*) You can use CTRL U to clear the *entire* prompt line.
-
- -r Get DOS revision. <sym> [major|minor|both]
- Sets symbol to the desired portion of the DOS version.
- Default = Both.
- ERRORLEVEL: None.
- Example: tbu -r rev major
-
- -d Get system date. <sym> <format>
- Sets symbol to the system date in the specified format.
- The format is embedded in a string: $[modifier]<element type>
- Element types: Allowable modifiers:
- y = year [a for 2 digit year]
- m = month [0_wWaA]
- d = day of month [0_]
- j = Julian date [0_]
- k = day of week [0_wWaA] (numeric Sun=0, Mon=1,...)
- Modifiers for numeric values:
- 0 = zero pad on left
- _ = space pad on left
- Modifiers for string values:
- w = full word instead of number (W = all upper case)
- a = abbreviated word instead of number (A = all upper case)
- ERRORLEVEL: None.
- Example: tbu -d date "The date is: $wk, $wm, $0d $y"
-
- (*) The result of the example is an environment variable "DATE"
- (*) containing the string:
- (*) The date is: Monday, March, 13 1989
- (*) Note that the omission of a comma in the above instruction leads
- (*) to no comma following the "13" in the environment variable itself.
- (*) Another example:
-
- (*) tbu -d dt $0m-$d-$ay
- (*) This creates a variable "dt" containing something like
- (*) 02-13-89 if it were 13 February, 1989, or something like
- (*) 11-15-89 if it were 15 November, 1989.
-
- -t Get system time. <sym> <format>
- Sets symbol to the system time in the specified format.
- The format is embedded in a string: $[modifier]<element type>
- Element types: Allowable modifiers:
- h = hours [0_]
- m = minutes
- s = seconds
- a = AM/PM (h = 1-12 if present)
- d = daylight (Y = daylight savings time in effect)
- Modifiers for numeric values:
- 0 = zero pad on left
- _ = space pad on left
- ERRORLEVEL: None.
- Example: tbu -t time "The time is: $0h:$m:$s $a"
-
- -b Substitute pattern for data. <sym> <patt> <data> <string>
- Replaces pattern with data in string. Sets symbol to
- the new string.
- ERRORLEVEL: Length of new string.
- Example: tbu -b new "change this" "to this" "Point: change this"
-
- (*) This last option is really a nice idea but the above docs make it
- (*) rather obscure in terms of how you use it, exactly. The closest I
- (*) can figure it is:
-
- (*) the first string is what you want to change
- (*) the second one is what you want to change it to.
- (*) the third is the COMPLETE string in which the "change from"
- (*) text appears. The phrase "replaces pattern with data in string"
- (*) in the docs above don't mean a damned thing to me!
-
- (*) So if you ALREADY have an environment variable "xx" which contains this
- (*) string: E:ED.DEF and you wanted to elimiate the "DEF"
- (*) and change it to "TXT," your instruction would be:
-
- (*) tbu -b xx "DEF" "TXT" "E:ED.DEF" - this does not appear to involve
- (*) case-sensitivity. Note that if you did NOT include the FULL string
- (*) "E:ED.DEF" then the environment variable "xx" would be changed
- (*) to read ONLY "TXT" - and NOT "E:ED.TXT".
-
- (*) Why the author designed it this way, I don't know. It thus sort
- (*) of is, but really isn't, a string search/replace utility. It's only
- (*) useful if you ALREADY KNOW what the contents of the environment
- (*) variable are. In which case: why not just alter it in its entirety
- (*) in your batch file?
-
- (*) Note that if you must specify a \ character in the string-search
- (*) routine, TBU appears to require that you delimit it with a second
- (*) backslash character. Thus: \\. So the string C:\AUTOEXEC.BAT
- (*) would have to be represented as: C:\\AUTOEXEC.BAT. However, this
- (*) may not always hold true. As said, this part of the program is
- (*) rather obscure.
-
- (*) Criticism of the docs notwithstanding, this is a GOOD program -
- (*) kudos (and thanks) to the author for writing it.
-
- Another Smileware program from Planet Terus <PT>. If you like it, send
- us a smile "*<B-)" at IFNA(tm) 104/43 -- (303) 469-7161.
-
-